<div id="pan">
	<?php echo $html->link(__('Home',true), '/'); ?> &gt; 
	<?php echo $html->link(__('Articles',true), '/articles'); ?> &gt; 
	<?php echo $html->link($mml['Article']['title'], array('controller'=> 'articles', 'action'=>'view', $mml['Article']['id'])); ?> &gt; 
	<strong><?php echo __('Edit MML Track',true); ?></strong>
</div>

<h2><?php if ($mml['Mml']['name'] == ''){
	echo sprintf(__('Edit MML Part of %s',true),$mml['Article']['title']);
}else{
	echo sprintf(__('Edit %2$s of %1$s',true),$mml['Article']['title'],$mml['Mml']['name']);
} ?></h2>

<div dojoType="dijit.Toolbar" class="title_toolbar">
	<button dojoType="dijit.form.Button" iconclass="LoreleiIcon LoreleiIconPlay" id="MmlPlay"><?php echo __('Play',true) ?></button>
	<button dojoType="dijit.form.Button" id="MmlStop" iconclass="LoreleiIcon LoreleiIconPlayerStop"><?php echo __('Stop',true) ?></button>
	<!--input type="radio" name="PlayType" value="midi" id="midi" dojoType="dijit.form.RadioButton" checked="checked" /><label for="midi">MIDI</label>
	<input type="radio" name="PlayType" value="jsmml" id="jsmml" dojoType="dijit.form.RadioButton" /><label for="jsmml">JSMML</label-->
	<button dojoType="dijit.form.Button" id="Clear" iconclass="LoreleiIcon LoreleiIconClear"><?php echo __('Clear',true) ?></button>
	<div dojoType="dijit.form.DropDownButton" iconclass="LoreleiIcon LoreleiIconMmlPaste">
		<span><?php echo __('Copy from Clipboard',true) ?></span>
		<div dojoType="dijit.TooltipDialog" id="Paste">
			<textarea name="mml" id="Mml" dojoType="dijit.form.SimpleTextarea" style="width:512px;height:48px;"></textarea>
			<p>
				<?php echo __('Please input the text of the MML form of Mabinogi into this form.',true);?> (MML@<i>[ch1]</i>,<i>[ch2],</i>,<i>[ch3]</i>;)<br />
				<?php echo __('If a lower paste button is pushed, it will divide into MML for every channel automatically.',true); ?>
			</p>
			<button id="MmlPaste" dojoType="dijit.form.Button"><?php echo __('Paste',true) ?></button>
			<button id="MmlClear" dojoType="dijit.form.Button"><?php echo __('Clear',true) ?></button>
		</div>
	</div>
	<button id="Copy" dojoType="dijit.form.Button" iconclass="LoreleiIcon LoreleiIconMmlCopy"><?php echo __('Copy to Clipboard',true) ?></button>
</div>

<?php echo $form->create('Mml',array('action' => 'edit','dojoType'=>'dijit.form.Form'))."\n";?>
<?php echo $form->hidden('id'); ?>
<?php echo $form->hidden('user_id'); ?>
<?php echo $form->hidden('article_id'); ?>
<dl>
	<dt><?php echo __('Track Name'); ?></th>
	<dd><?php echo $form->text('name',array(null,'dojoType'=>'dijit.form.TextBox',));?><span id="media"></span></dd>
	<dt><?php echo __('Instrument'); ?></dt>
	<dd><?php echo $form->select('instrument_id',
			array($instruments),$mml['Mml']['instrument_id'],
			array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'autocomplete'=>'false',
				'ignoreCase'=>'false',
				'hasDownAllow'=>'true',
				'style'=>'width:140px',
				'id'=>'instrument'
			),
		false); ?>
		<input type="button" id="tone_checker" class="icon" />
	</dd>
	<dt><?php echo __('Panpod'); ?></dt>
	<dd><?php echo $form->text('pan',
		array(
			'dojoType'=>'dijit.form.TextBox',
			'value'=>$mml['Mml']['pan'],
			'size'=>3,
			'style'=>'width:32px;',
			'onChange'=>"dijit.byId('pan_slider').value = this.value",
			'disabled'=>'disabled'
		)
	); ?>
		<div dojoType="dijit.form.HorizontalSlider" name="data[Mml][pan]"
			onChange="document.getElementById('MmlPan').value=(arguments[0]|0);"
			value="<?php echo $mml['Mml']['pan']; ?>"
			maximum="128"
			minimum="0"
			discreteValues="9"
			intermediateChanges="true"
			style="height: 20px;width:95%;"
			id="pan_slider"
		>
			<div dojoType="dijit.form.HorizontalRule" container="bottomDecoration" count=9 style="height:3px;"></div>
			<div dojoType="dijit.form.HorizontalRule" container="bottomDecoration" count="9" style="height:6px;"></div>
			<ol dojoType="dijit.form.HorizontalRuleLabels" container="bottomDecoration" style="height:1em;font-size:9px;color:gray;">
				<li><?php echo __('Left',false); ?></li>
				<li><?php echo __('Center',false); ?></li>
				<li><?php echo __('Right',false); ?></li>
			</ol>
		</div>
	</dd>
	<dt><?php echo __('Rank',true); ?></dt>
	<dd><?php echo $form->select('rank',
			array($ranks),$mml['Mml']['rank_id'],
			array(
				'dojoType'=>'dijit.form.FilteringSelect',
				'autocomplete'=>'false',
				'ignoreCase'=>'false',
				'hasDownAllow'=>'true',
				'style'=>'width:48px',
				'id'=>'rank_id'
			),
		false); ?><?php echo $form->hidden('rank_id'); ?>
	</dd>
	<dt><?php echo __('MML'); ?></th>
	<dd>
		<div id="composer-display">
			<div class="composer-display-item">
				<div class="composer-display-radio">
					<input type="radio" name="Track" id="ch1_radio" dojoType="dijit.form.RadioButton" value="ch1" checked="checked" />
					<label for="ch1_radio"><?php echo __('Melody',true); ?></label>
				</div>
				<div class="composer-display-length">
					<label for="ch1_length"><?php echo __('Length',true); ?></label>
					<input name="ch1_length" id="ch1_length" disabled="disabled" type="text" value="0" dojoType="dijit.form.TextBox" />
				</div>
				<?php echo $form->textarea('ch1',array(
					'dojoType'=>'dijit.form.SimpleTextarea',
					'class'=>'mml',
					'warp'=>'soft',
					'id'=>'ch1'
				));?>
			</div>
			<div class="composer-display-item">
				<div class="composer-display-radio">
					<input type="radio" name="Track" id="ch2_radio" dojoType="dijit.form.RadioButton" value="ch2" />
					<label for="ch2_radio"><?php echo __('Chord 1',true); ?></label>
				</div>
				<div class="composer-display-length">
					<label for="ch2_length"><?php echo __('Length',true); ?></label>
					<input name="ch2_length" id="ch2_length" disabled="disabled" type="text" value="0" dojoType="dijit.form.TextBox" />
				</div>
				<?php echo $form->textarea('ch2',array(
					'dojoType'=>'dijit.form.SimpleTextarea',
					'class'=>'mml',
					'warp'=>'soft',
					'id'=>'ch2'
				));?>
			</div>
			<div class="composer-display-item">
				<div class="composer-display-radio">
					<input type="radio" name="Track" id="ch3_radio" dojoType="dijit.form.RadioButton" value="ch3" />
					<label for="ch3_radio"><?php echo __('Chord 2',true); ?></label>
				</div>
				<div class="composer-display-length">
					<label for="ch3_length"><?php echo __('Length',true); ?></label>
					<input name="ch3_length" id="ch3_length" disabled="disabled" type="text" value="0" dojoType="dijit.form.TextBox" />
				</div>
				<?php echo $form->textarea('ch3',array(
					'dojoType'=>'dijit.form.SimpleTextarea',
					'class'=>'mml',
					'warp'=>'soft',
					'id'=>'ch3'
				));?>
			</div>
		</div>
	</dd>
</dl>
<div class="action">
	<button type="submit" dojoType="dijit.form.Button"><?php echo $html->image('icons/16x16/filesave.png', array('alt'=>__('Save', true), 'border'=>"0")).'&nbsp;'.__('Save',true) ?></button>
	<button type="reset" dojoType="dijit.form.Button"><?php echo $html->image('icons/16x16/reload.png', array('alt'=>__('Reset', true), 'border'=>"0")).'&nbsp;'.__('Reset',true) ?></button>&nbsp;
	<button id="cancel" dojoType="dijit.form.Button" onclick="cancel();"><?php echo $html->image('icons/16x16/cancel.png', array('alt'=>__('Cancel', true), 'border'=>"0")).'&nbsp;'.__('Cancel',true) ?></button>
</div>
<?php echo $form->end();?>

<ul id="help">
	<li dojoType="dijit.Tooltip" connectId="rank" position="below"><?php echo __('According to the length of inputted MML, the skill rank which can write music is displayed automatically.',true);?><br /><?php echo __('In mabinogi, it is mounted only to 7 now.',true);?></li>
	<li dojoType="dijit.Tooltip" connectId="ch1" position="below"><?php echo sprintf(__('MML of a %s is inputted.',true),__('Melody',true)); ?><br /><?php echo sprintf(__('It can input to %d characters. However, the number of characters which can be play by the present Mabinogi is to %d characters.', true),'1200','900'); ?></li>
	<li dojoType="dijit.Tooltip" connectId="ch1_length"><?php echo sprintf(__('The number of characters of MML of a %s is displayed.',true),__('Melody',true)); ?></li>
	<li dojoType="dijit.Tooltip" connectId="ch2" position="below"><?php echo sprintf(__('MML of a %s is inputted.',true),__('Chord 1',true)); ?><br /><?php echo sprintf(__('It can input to %d characters. However, the number of characters which can be play by the present Mabinogi is to %d characters.', true),'800','400'); ?><br /><?php echo __('Notice: Even if it puts in a tempo command here, the technical specification of QuickTime is not reflected by Lolerei.',true); ?></li>
	<li dojoType="dijit.Tooltip" connectId="ch2_length"><?php echo sprintf(__('The number of characters of MML of a %s is displayed.',true),__('Chord 1',true)); ?></li>
	<li dojoType="dijit.Tooltip" connectId="ch3" position="below"><?php echo sprintf(__('MML of a %s is inputted.',true),__('Chord 2',true)); ?><br /><?php echo sprintf(__('It can input to %d characters. However, the number of characters which can be play by the present Mabinogi is to %d characters.', true),'500','200'); ?><br /><?php echo __('Notice: Even if it puts in a tempo command here, the technical specification of QuickTime is not reflected by Lolerei.',true); ?></li>
	<li dojoType="dijit.Tooltip" connectId="ch3_length"><?php echo sprintf(__('The number of characters of MML of a %s is displayed.',true),__('Chord 2',true)); ?></li>
	<li dojoType="dijit.Tooltip" connectId="instrument_id" position="above"><?php echo __('A musical instrument to play is chosen.',true);?><br /><?php echo sprintf(__('It can be checked whether it is a musical instrument which can be played by clicking on a right icon %s.',true),$html->image('icons/16x16/spellcheck.png', array('alt'=> __('Tone Check', true), 'border'=>'0')));?></li>
	<li dojoType="dijit.Tooltip" connectId="result" position="below"><?php echo __('It can be checked whether it is a musical instrument which can be normally played by clicking on this icon.',true); ?><br /></li>
</ul>

<script type="text/javascript">
lorelei.mml.checker.check.rank();
</script>
<?php
$this->addScript($javascript->codeBlock('
dojo.require("dojo.parser");
dojo.require("dojo.back");
dojo.require("dijit.Dialog");
dojo.require("dijit.Menu");
dojo.require("dijit.Toolbar");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.CheckBox");
dojo.require("dijit.form.FilteringSelect");
dojo.require("dijit.form.Form");
dojo.require("dijit.form.SimpleTextarea");
dojo.require("dijit.form.Slider");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.form.Textarea");
dojo.require("dojox.form.DropDownSelect");
dojo.require("lorelei.mml.form");

var article_id = "'.$mml['Article']['id'].'";
var user_id = "'.$mml['Article']['user_id'].'";
var auth_id = "'.$auth['User']['id'].'";

message = {
	"clipboard":"'.__('Copying to clipboard by Mabinogi MML format.',true).'\n'.__('Note: Clipboard will be overwritten.',true).'\n\n'.__('Please use with the common sense.',true).'",
	"delete":"'.__('Are you sure to delete the contents in this form?',true).'",
	"unknown_format":"'.__('Unknown MML format.',true).'"
};

lorelei.mml.form();

',array('inline' => false))); ?>